<!doctype html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="th/m/include/head :: head(~{::title}, ~{::style})">
    <meta charset="utf-8">
    <title>我</title>
    <style>
        .photo {
            max-width: 80px;
            max-height: 80px;
            vertical-align: middle;
        }
    </style>
</head>
<body>
<div class="mui-content">
    <div class="mui-table mui-table-view-cell user-box">
        <div class="mui-table-cell mui-col-xs-4"><span>
            <th:block th:if="${user.photo ne '' && user.photo != null}">
                <img class="photo" th:src="@{'/showImg?path=' + ${user.photo}}" style="width:130px"/>
            </th:block>
            <th:block th:if="${user.photo eq '' || user.photo == null}">
                <img th:if="${user.gender eq 0}" class="photoImg" th:src="@{'/static/images/man.png'}" style="width:29px"/>
                <img th:else class="photoImg" th:src="@{'/static/images/woman.png'}" style="width:29px"/>
            </th:block>
        </span></div>
        <div class="mui-table-cell mui-col-xs-8"><span>[[${user.realName}]]</span></div>
    </div>
    <div class="mui-table mui-table-view-cell">
        <div class="mui-table-cell mui-col-xs-4"><span class="mui-icon mui-icon-compose" style="font-size: 30px"></span>
        </div>
        <div class="mui-table-cell mui-col-xs-8">
            <span class="mui-push-right"></span>
            <span onclick="modifyPwd()">修改密码</span></div>
    </div>
    <div class="mui-table mui-table-view-cell">
        <div class="mui-table-cell mui-col-xs-4"><span class="mui-icon mui-icon-redo" style="font-size: 30px"></span>
        </div>
        <div class="mui-table-cell mui-col-xs-8"><span onclick="logout()">退出登录</span></div>
    </div>
</div>
<div th:replace="th/m/include/navbar :: nav(${nav}, false, '', true)"></div>
</body>
<script th:inline="javascript">
    function modifyPwd() {
        window.location.href = 'mePwd';
    }

    function logout() {
        var btnArray = ['确认', '取消'];
        mui.confirm('确认删除要退出么？', '提示', btnArray, function (e) {
            if (e.index == 0) {
                var expdate = new Date();
                expdate.setTime(-1000);

                document.cookie = "isMyLoginAuto=;expires=" + expdate.toGMTString() + ";path=/";
                document.cookie = "pwd=;expires=" + expdate.toGMTString() + ";path=/";

                window.location.href = "../logout?redirectUrl=wap/index";
            }
        });
    }

    $(function() {
        mui('.mui-content').on("tap", '.user-box', function (e) {
            e.preventDefault();
            mui.openWindow({
                "url": "editUserPage?skey=" + [[${nav.skey}]],
                "id": "userEditWin"
            });
        });
    })
</script>
</html>